package com.proba.annotations.pojo;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.samples.mvc.basic.model.Identifiable;

/**
 * <p>Pojo mapping TABLE MAVROVO.PARTNER</p>
 *
 * <p>Generated at Thu Feb 25 19:39:57 CET 2010</p>
 * @author Salto-db Generator v1.0.16 / EJB3
 * 
 */
@Entity 
@Table(name = "PARTNER", schema = "MAVROVO")
@SuppressWarnings("serial")
@javax.persistence.SequenceGenerator(
    name="partner_seq",
    sequenceName="partner_seq", allocationSize=1
)
public class Partner implements Identifiable {

	/**
	 * Attribute id.
	 */
	private Long id;
	
	/**
	 * Attribute partner.
	 */
	private String partner;
	
	/**
	 * Attribute tipPartner
	 */
	 private TipPartner tipPartner;	

	/**
	 * Attribute sluzba.
	 */
	private Sluzba sluzba;
	
	/**
	 * List of IzvrsenaRealizacija
	 */
	private List<IzvrsenaRealizacija> izvrsenaRealizacijas = null;
	
	private String tehnickiBroj;

	
	/**
	 * @return id
	 */
	@Basic
	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="partner_seq")
		public Long getId() {
		return id;
	}

	/**
	 * @param id new value for id 
	 */
	public void setId(Long id) {
		this.id = id;
	}
	
	/**
	 * @return partner
	 */
	@Basic
	@Column(name = "PARTNER", length = 50)
		public String getPartner() {
		return partner;
	}

	/**
	 * @param partner new value for partner 
	 */
	public void setPartner(String partner) {
		this.partner = partner;
	}
	
	/**
	 * get tipPartner
	 */
	@ManyToOne
	@JoinColumn(name = "TIP_PARTNER")
	public TipPartner getTipPartner() {
		return this.tipPartner;
	}
	
	/**
	 * set tipPartner
	 */
	public void setTipPartner(TipPartner tipPartner) {
		this.tipPartner = tipPartner;
	}

	/**
	 * @return sluzba
	 */
	@ManyToOne
	@JoinColumn(name = "SLUZBA")
		public Sluzba getSluzba() {
		return sluzba;
	}

	/**
	 * @param sluzba new value for sluzba 
	 */
	public void setSluzba(Sluzba sluzba) {
		this.sluzba = sluzba;
	}
	
	/**
	 * Get the list of IzvrsenaRealizacija
	 */
	 @OneToMany(mappedBy="partner")
	 public List<IzvrsenaRealizacija> getIzvrsenaRealizacijas() {
	 	return this.izvrsenaRealizacijas;
	 }
	 
	/**
	 * Set the list of IzvrsenaRealizacija
	 */
	 public void setIzvrsenaRealizacijas(List<IzvrsenaRealizacija> izvrsenaRealizacijas) {
	 	this.izvrsenaRealizacijas = izvrsenaRealizacijas;
	 }

	 public String toString() {
		 return this.partner;
	 }

	public String getTehnickiBroj() {
		return tehnickiBroj;
	}

	public void setTehnickiBroj(String tehnickiBroj) {
		this.tehnickiBroj = tehnickiBroj;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((partner == null) ? 0 : partner.hashCode());
		result = prime * result + ((sluzba == null) ? 0 : sluzba.hashCode());
		result = prime * result
				+ ((tehnickiBroj == null) ? 0 : tehnickiBroj.hashCode());
		result = prime * result
				+ ((tipPartner == null) ? 0 : tipPartner.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Partner other = (Partner) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (partner == null) {
			if (other.partner != null)
				return false;
		} else if (!partner.equals(other.partner))
			return false;
		if (sluzba == null) {
			if (other.sluzba != null)
				return false;
		} else if (!sluzba.equals(other.sluzba))
			return false;
		if (tehnickiBroj == null) {
			if (other.tehnickiBroj != null)
				return false;
		} else if (!tehnickiBroj.equals(other.tehnickiBroj))
			return false;
		if (tipPartner == null) {
			if (other.tipPartner != null)
				return false;
		} else if (!tipPartner.equals(other.tipPartner))
			return false;
		return true;
	}
	
	

}